<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/dummy</span></span>
</span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP</span> <span class="number">200</span></span>
<span class="line"><span class="section-header">[Captures]</span></span>
<span class="line"><span class="string">count</span>: <span class="query-type">jsonpath</span> <span class="string">"$.books"</span> <span class="filter-type">count</span></span>
<span class="line"><span class="section-header">[Asserts]</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.books"</span> <span class="filter-type">count</span> <span class="predicate-type">==</span> <span class="number">12</span></span>                                                              <span class="comment"># count</span>
<span class="line"><span class="query-type">certificate</span> <span class="string">"Expire-Date"</span> <span class="filter-type">daysAfterNow</span> <span class="predicate-type">&gt;</span> <span class="number">15</span></span>                                                 <span class="comment"># daysAfterNow</span>
<span class="line"><span class="query-type">certificate</span> <span class="string">"Start-Date"</span> <span class="filter-type">daysBeforeNow</span> <span class="predicate-type">&lt;</span> <span class="number">100</span></span>                                                <span class="comment"># daysBeforeNow</span>
<span class="line"><span class="query-type">bytes</span> <span class="filter-type">decode</span> <span class="string">"iso-8859-1"</span> <span class="predicate-type">==</span> <span class="string">"café"</span></span>                                                         <span class="comment"># decode</span>
<span class="line"><span class="query-type">cookie</span> <span class="string">"LSID[Expires]"</span> <span class="filter-type">format</span> <span class="string">"%a, %d %b %Y %H:%M:%S"</span> <span class="predicate-type">==</span> <span class="string">"Wed, 13 Jan 2021 22:23:01"</span></span>        <span class="comment"># format</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.text"</span> <span class="filter-type">htmlEscape</span> <span class="predicate-type">==</span> <span class="string">"a &amp;gt; b"</span></span>                                                  <span class="comment"># htmlEscape</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.escaped_html[1]"</span> <span class="filter-type">htmlUnescape</span> <span class="predicate-type">==</span> <span class="string">"&lt;p&gt;Hello&lt;/p&gt;"</span></span>                                 <span class="comment"># htmlUnescape</span>
<span class="line"><span class="query-type">variable</span> <span class="string">"books"</span> <span class="filter-type">jsonpath</span> <span class="string">"$[0].name"</span> <span class="predicate-type">==</span> <span class="string">"Dune"</span></span>                                             <span class="comment"># jsonpath</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.books"</span> <span class="filter-type">nth</span> <span class="number">2</span> <span class="predicate-type">==</span> <span class="string">"Children of Dune"</span></span>                                              <span class="comment"># nth</span>
<span class="line"><span class="query-type">body</span> <span class="filter-type">regex</span> <span class="regex">/Hello ([0-9]+)!/</span> <span class="predicate-type">==</span> <span class="string">"Bob"</span></span>                                                       <span class="comment"># regex</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.ips"</span> <span class="filter-type">replace</span> <span class="string">", "</span> <span class="string">"|"</span> <span class="predicate-type">==</span> <span class="string">"192.168.2.1|10.0.0.20|10.0.0.10"</span></span>                      <span class="comment"># replace</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.ips"</span> <span class="filter-type">split</span> <span class="string">", "</span> <span class="filter-type">count</span> <span class="predicate-type">==</span> <span class="number">3</span></span>                                                      <span class="comment"># split</span>
<span class="line"><span class="query-type">header</span> <span class="string">"Expires"</span> <span class="filter-type">toDate</span> <span class="string">"%a, %d %b %Y %H:%M:%S GMT"</span> <span class="filter-type">daysBeforeNow</span> <span class="predicate-type">&gt;</span> <span class="number">1000</span></span>                    <span class="comment"># toDate</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.pi"</span> <span class="filter-type">toFloat</span> <span class="predicate-type">==</span> <span class="number">3.14</span></span>                                                             <span class="comment"># toFloat</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.id"</span> <span class="filter-type">toInt</span> <span class="predicate-type">==</span> <span class="number">123</span></span>                                                                <span class="comment"># toInt</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.encoded_url"</span> <span class="filter-type">urlDecode</span> <span class="predicate-type">==</span> <span class="string">"https://mozilla.org/?x=шеллы"</span></span>                        <span class="comment"># urlDecode</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.url"</span> <span class="filter-type">urlEncode</span> <span class="predicate-type">==</span> <span class="string">"https%3A//mozilla.org/%3Fx%3D%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"</span></span> <span class="comment"># urlEncode</span>
<span class="line"><span class="query-type">bytes</span> <span class="filter-type">decode</span> <span class="string">"iso-8859-1"</span> <span class="filter-type">xpath</span> <span class="string">"string(//p)"</span> <span class="predicate-type">==</span> <span class="string">"Hello"</span></span>                                    <span class="comment"># xpath</span>
</span></span></code></pre>
